﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace Lab1.CriterionSpace
{
    /// <summary>
    /// Interaction logic for Index.xaml
    /// </summary>
    public partial class Index : Page
    {
        private CriterionService CriterionService = new CriterionService();
        public Index()
        {
            InitializeComponent();
      
            var all = CriterionService.getAll(); 
            CriterionListBox.DataContext = all;    
        }

        private void Create(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Create());
        }

        private void Edit(object sender, RoutedEventArgs e)
        {
            Criterion Criterion = (Criterion)CriterionListBox.SelectedItem;
            this.NavigationService.Navigate(new Edit(Criterion));
        }

        private void Delete(object sender, RoutedEventArgs e)
        {
            Criterion Criterion = (Criterion)CriterionListBox.SelectedItem;
            this.NavigationService.Navigate(new Delete(Criterion));
        }
    }
}
